package cn.fengzhilun.javase.day11;

import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;

import org.junit.Test;

import cn.fengzhilun.javase.day11.OutterClass.InnerClass;

//import cn.fengzhilun.javase.day11.OutterClass.InnerClass;

public class TestInnerClass {
	@Test
	public void test1() throws InterruptedException {
		Timer time=new Timer();
		
		
		TimerTask task=new TimerTask() {

			@Override
			public void run() {
				System.out.println("...");
			}
		};
		time.schedule(task,0, 1000);
		Thread.sleep(8000);
	}
	
	@Test
	public void test2() throws InterruptedException {

//		Runnable runnable =new Runnable() {
//
//			@Override
//			public void run() {
//				System.out.println("Runnable输出。");
//			}
//		};
//		Thread t= new Thread(runnable);
		Thread t=new Thread(()->{
			System.out.println("线程跑了起来");
		});
		t.start();
		Thread.sleep(8000);
		
	}
	@Test
	public void test3() {
		OutterClass out =new OutterClass();
		
	     InnerClass in=out .new InnerClass();
		
		//OutterClass.InnerClass c= new OutterClass.InnerClass();
		//InnerClass c=new InnerClass();
	}
	@Test
	public void test4() {
		System.out.println(findPrimesIn100WithList2());
		
	}
	
	public static List<Integer> findPrimesIn100WithList2() {
		
		List<Integer> list= new ArrayList<>();
		
		for(int i=2;i<=100;i++) {
			
			if(isPrime(i)) {
				list.add(i);
			}
		}
		
		return list;
		
	}
	public static  boolean isPrime(int number) {
		boolean flag=true;
		for(int i=2;i<number;i++) {
			if(number%i==0) {
				return false;
			}
			
		}
		return flag;
	}
}
